package com.netx.ut.lib.hibernate;
import java.io.Serializable;


public class LineItem extends EntityInstance implements Serializable {

	private Order _order = null;
	private Product _product = null;
	private Integer _quantity = new Integer(1);
	
	public LineItem() {}
	
	public Order getOrder() { return _order; };
	public LineItem setOrder(Order value) { _order = value;	return this; }
	public Product getProduct() { return _product; };
	public LineItem setProduct(Product value) { _product = value; return this; }
	public Integer getQuantity() { return _quantity; };
	public LineItem setQuantity(Integer value) { _quantity = value; return this; }
	
	public boolean equals(Object o) {
		if(o == null) {
			return false;
		}
		if(this == o) {
			return true;
		}
		if(!(o instanceof LineItem)) {
			return false;
		}
		LineItem li = (LineItem)o;
		if(_order == null && li._order != null) {
			return false;
		}
		if(li._order == null && _order != null) {
			return false;
		}
		if(_product == null && li._product != null) {
			return false;
		}
		if(li._product == null && _product != null) {
			return false;
		}
		return _order.equals(li._order) && _product.equals(li._product);
	}
	
	public int hashCode() {
		int hashCode = 7;
		if(_order != null) {
			hashCode = 31 * hashCode + _order.hashCode();
		}
		if(_product != null) {
			hashCode = 31 * hashCode + _product.hashCode();
		}
		return hashCode;
	}
}
